home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1990: Night of the Living Disc / Night of the Living Disc.2mg / Dev.CD.5 / Tools / DTS.Samples / SC09Lister / CustProc.asm < prev    next >
Encoding:
Assembly Source File  |  1990-05-25  |  26.4 KB  |  723 lines  |  [B0] Apple IIgs Source Code (0x0003)

  1. ***********************************************************************
  2. * Simple Custom Control procedure for Lister -- Version 3.0
  3. * Copyright (c)
  4. * Apple Computer, Inc.  1990
  5. * All Rights Reserved.
  6. *
  7. * Developer Technical Support Apple II Sample Code
  8. *
  9. * Written by C.K.Haun <TR>
  10. * Apple II Developer Technical Support
  11. *
  12. * This is the custom control that defines what kinds of border lines
  13. * are drawn on Lister's output.
  14. * Of course, it can be adapted to be anything you'd like it to be, in it's
  15. * current form it could be a design tool for a warped tic-tac-toe game.  Or
  16. * change things around to make that control you've always wanted.
  17. *
  18. * This infomation is passed back to the application through the normal
  19. * _GetControlValue call, with the word value returned being a series
  20. * of bit flags like so....
  21. * 0000000000000000
  22. * ||||||||||||||||
  23. * ||||||||||||||| Line across top
  24. * |||||||||||||| 2nd top line
  25. * ||||||||||||| inner bottom line
  26. * |||||||||||| bottom bottom line
  27. * ||||||||||| left side line
  28. * |||||||||| center line
  29. * ||||||||| right line
  30. * <reserved>         We like saying <reserved> here at Apple Co.
  31. * In your application activity, when you get a hit in this control you'll look
  32. * at the part code returned and toggle your set-up and the control value, 
  33. * as you would to change the state of a radio button.
  34. *****************************************************************************
  35.  
  36.                     case on
  37.  
  38.                     longi on
  39.                     longa on
  40.  
  41. ***********************************************************************
  42.  
  43.                     copy 2/ainclude/e16.control
  44.                     mcopy macros/custproc.macros
  45.  
  46.  
  47. *                   Export boxControl
  48. boxControl          start
  49.  
  50.  
  51. *  Everything comes through here, with a standard header.  So 
  52. *  we process the header and jump to the right place, neh?
  53.  
  54.                     phb                 ; save old program bank
  55.                     phk                 ; get current PB
  56.                     plb
  57.                     pla
  58.                     sta rtlAndDB
  59.                     pla
  60.                     sta rtlAndDB+2      ; save for later
  61.  
  62.                     lda 1,s             ; passed control handle
  63.                     sta ctlHandle
  64.                     lda 3,s
  65.                     sta ctlHandle+2
  66.  
  67.  
  68. * I'm going copy the control handle for some of the calls 
  69. * to this code area.  
  70. * I'm checking here to see if this call is one I need to copy the params for.
  71.                     lda 9,s             ; ctlMessage
  72.                     ldx #8
  73. doCopyCheck         cmp copiers,x       ; is it something I care about the
  74. *                                       ; record for?
  75.                     beq yesCopy         ; yes
  76.                     dex
  77.                     dex
  78.                     bpl doCopyCheck
  79.  
  80.                     pla                 ; it wasn't, pull the handle
  81.                     pla                 ; off the stack
  82.                     bra didntCopyHandle ; and go away
  83.  
  84. yesCopy             anop                ; Note here that the ctlHandle is still on
  85. *                                       ; the stack.  It is the last thing on there,
  86. *                                       ; so this can act as a parameter for _HdndToPtr.
  87.                     pushlong #theControlRecord
  88.                     pea 0
  89.                     lda recordLength
  90.                     pha
  91.                     _HandToPtr          ; The ctlHandle is not on the stack any longer.
  92.  
  93.  
  94. didntCopyHandle     pla                 ; parameter passed,occasionally needed
  95.                     sta ctlParamPassed
  96.                     pla
  97.                     sta ctlParamPassed+2
  98.                     pla                 ; the op number, we'll use this to....
  99.                     asl a
  100.                     tax
  101.                     jmp (boxRoutines,x) ; jump to the right routine
  102.  
  103. drawBox             ANOP                ; draws the control
  104.                     jsr setCtlPort
  105.                     jsr drawRects
  106.                     jsr restorePort
  107.                     jmp exitNull
  108.  
  109. calcBox             jmp exitNull        ; use if the rectangle you want the CM to
  110. *                                       ; drag a different
  111. *                                       ; rectangle than the standard one
  112. *                                       ; use the standard rectangle 
  113.  
  114. testBox             ANOP                ; Hit test our control
  115.  
  116.                     lda #6              ; Loop until we find which part this is in...
  117. rectTestLoop        pha
  118.                     pea 0
  119.                     ldy #ctlParamPassed|-16 ; mouse click, in local coords.
  120.                     phy
  121.                     ldy #ctlParamPassed
  122.                     phy
  123.                     asl a
  124.                     tax
  125.                     lda #boxInnerRects|-16
  126.                     pha
  127.                     lda boxInnerRects,x
  128.                     pha
  129.                     _PtInRect
  130.                     pla
  131.                     bne foundit
  132.                     pla
  133.                     dea
  134.                     bpl rectTestLoop
  135.                     pha                 ; acc = $FF, so when incremented, it
  136. *                                       ; will be 0, which indicates no part hit.
  137. foundit             lda #0
  138.                     sta 3,s
  139.                     pla
  140.                     ina                 ; pass back 1+part, so the $FF case
  141.                     sta 1,s             ; becomes the no-part event.
  142.  
  143.                     jmp exitCustom
  144.  
  145.  
  146. initBox             ANOP
  147. * This is the place where you set up all your internal parts, additional
  148. * parameters, and load any other data or resources you'll need for this
  149. * control.
  150. * First check to see if there is anything other than standard for us
  151. * like an inital value or color table
  152.                     pushlong $0
  153.                     lda ctlParamPassed+2 ; In sys 5.0 and later this parameter 
  154.                     sta $2              ; contains a pointer to the control
  155. *                                       ; template, if
  156.                     lda ctlParamPassed  ; _NewControl2 was used to create
  157.                     sta $0              ; the control.
  158.                     lda [$0]
  159.                     cmp #6              ; minimum param count
  160.                     beq nonextra        ; no additional parameters
  161.                     tax
  162.                     ldy #26             ; passed init value, store it in the 
  163.                     lda [$0],y          ; record
  164.                     sta boxValue
  165.                     cpx #8              ; was there a color table?
  166.                     bne nonextra
  167.                     iny                 ; There was a color table. Put the 
  168.                     iny                 ; reference to it in the control record
  169.                     lda [$0],y
  170.                     sta boxColors
  171.                     iny
  172.                     iny
  173.                     lda [$0],y
  174.                     sta boxColors+2
  175. nonextra            pulllong $0         ; Initialize all our rectangles
  176.                     lda masterRect+4    ; First see if the User specified end 
  177.                     ora masterRect+6    ; coords
  178.                     bne userInited      ; we have to do it, use
  179.                     lda masterRect      ; standard x2,y2 values
  180.                     clc
  181.                     adc defaultRect
  182.                     sta masterRect+4
  183.                     lda masterRect+2
  184.                     clc
  185.                     adc defaultRect+2
  186.                     sta masterRect+6
  187. userInited          anop
  188. * Now we set up our inner rects
  189.  
  190.                     lda masterRect
  191.                     sta iRect6
  192.                     sta iRect5
  193.                     sta iRect7
  194.                     sta iRect1
  195.                     clc
  196.                     adc #3
  197.                     sta iRect1+4
  198.                     clc
  199.                     adc #2
  200.                     sta iRect2
  201.                     clc
  202.                     adc #3
  203.                     sta iRect2+4
  204.  
  205.                     lda masterRect+2
  206.                     sta iRect5+2
  207.                     clc
  208.                     adc #5
  209.                     sta iRect1+2
  210.                     sta iRect2+2
  211.                     sta iRect3+2
  212.                     sta iRect4+2
  213.                     sta iRect5+6
  214.  
  215.                     lda masterRect+4
  216.                     sta iRect6+4
  217.                     sta iRect5+4
  218.                     sta iRect4+4
  219.                     sta iRect7+4
  220.                     sec
  221.                     sbc #3
  222.                     sta iRect4
  223.                     sbc #2
  224.                     sta iRect3+4
  225.                     sbc #3
  226.                     sta iRect3
  227.                     sta iRect7+2
  228.  
  229.                     lda masterRect+6
  230.                     sta iRect7+6
  231.                     sec
  232.                     sbc #5
  233.                     sta iRect1+6
  234.                     sta iRect2+6
  235.                     sta iRect3+6
  236.                     sta iRect4+6
  237.                     sta iRect7+2
  238.  
  239.                     lda masterRect+6    ; center the middle bit
  240.                     sec
  241.                     sbc masterRect+2
  242.                     lsr a
  243.                     clc
  244.                     adc masterRect+2
  245.                     dea
  246.                     dea
  247.                     sta iRect6+2
  248.                     adc #5
  249.                     sta iRect6+6
  250.  
  251.                     pushlong #theControlRecord  ; Pass these rects
  252.                     pushlong ctlHandle          ; back to the control record ..
  253.                     pea 0                       ; please
  254.                     lda recordLength
  255.                     pha
  256.                     _PtrToHand
  257. * Putting all the parameters we just initialized back in the control record 
  258. * is _very_ important. 
  259. * First this makes sure that the inital tracking the CM does is
  260. * correct and we don't have to calculate our rectangles every time we
  261. * enter our routine.
  262. * Second, you may want a few of these custom controls.  The control record 
  263. * keeps everything for each control in it's own special place.
  264. * Third, keep in mind that your control proc can be a resource.  If it's
  265. * a resource, then it could get purged and re-loaded.  If that happens, and
  266. * you're expecting data to hang around inside the proc then you're in 
  267. * big trouble.
  268.  
  269.  
  270.                     jmp exitNull
  271.  
  272.  
  273.  
  274. disposeBox          jmp exitNull        ; we didn't allocate anything we need 
  275. *                                       ; to clean up
  276. *                                       ; If you had loaded a picture or icon, 
  277. *                                       ; or allocated any
  278. *                                       ; additional memory, you'd clean it up .
  279. *                                       ; here
  280.  
  281. positionBox         jmp exitCustom      ; If you have an indicator, you'd set
  282. *                                       ; it here
  283.  
  284. thumbBox            jmp exitNull        ; this routine sets up the _DragRect 
  285. *                                       ; parameters for the
  286. *                                       ; thumb of your control, if you have 
  287. *                                       ; one. The CM will take
  288. *                                       ; the param block you create here and
  289. *                                       ; pass it to _DragRect
  290. *                                       ; no thumb 
  291.  
  292. dragBox             jmp exitNull        ; Put your custom dragging routine here
  293. *                                       ; if you have one
  294. *                                       ; I'm telling the CM to use the  
  295. *                                       ; standard dragging action
  296. *                                       ; with a rect the size of the complete 
  297. *                                       ; control.
  298.  
  299. trackBox            jmp exitNull
  300.  
  301. newboxValue         lda #0              ; I do nothing extra with the new val
  302.                     sta ctlParamPassed
  303.                     jmp drawBox         ; but we should redraw if the value 
  304. *                                       ; changed
  305.  
  306. newAdditionalParams jmp exitNull        ; we do nothing with these, the CM 
  307. *                                       ; has already put them in the
  308. *                                       ; control record.  Things like scroll 
  309. *                                       ; bars use these.
  310.  
  311.  
  312. moveBox             lda masterRect      ; re-calculate the inner rects after
  313.                     sec                 ; the control has been
  314.                     sbc ctlParamPassed  ; moved by _MoveControl
  315.                     sta masterRect
  316.                     lda masterRect+2
  317.                     sec
  318.                     sbc ctlParamPassed+2
  319.                     sta masterRect+2
  320.                     lda masterRect+4
  321.                     sec
  322.                     sbc ctlParamPassed
  323.                     sta masterRect+4
  324.                     lda masterRect+6
  325.                     sec
  326.                     sbc ctlParamPassed+2
  327.                     sta masterRect+6
  328.                     jmp initBox         ; let our original routine
  329. *                                       ; re-calc the other rects
  330.  
  331.  
  332. sendRecSize         ANOP                ; this tells the control manager what 
  333. *                                       ; size handle to
  334.                     lda recordLength    ; allocate for our control record
  335.                     sta 1,s
  336.                     lda #0
  337.                     sta 3,s
  338.                     jmp exitCustom
  339.  
  340.  
  341. * All of the following fall through to null exit
  342. * They are new calls for extended controls, and deal with controls that can
  343. * act as targets ( like LineEdit controls ) Window position aware controls
  344. * ( like TextEdit controls ) Multi-part controls ( LineEdit, PopUp, List, etc. )
  345.  
  346. boxHandleEvent      ANOP
  347. boxStatusToggle     ANOP
  348. boxRectChanged      ANOP
  349. boxWindowChanged    ANOP
  350. boxTabbedTo         ANOP
  351. boxMultiPart        ANOP
  352. boxWindStateChanged ANOP
  353. exitNull            ANOP                ; this is the exit point for custom 
  354.                     lda #0              ; routines that don't use a specific  
  355.                     sta 1,s             ; function. You should fill the return 
  356.                     sta 3,s             ; parameters with 0's if you don't 
  357. *                                       ; support a function. Not _maniditory_, 
  358. *                                       ; as some of the routines return parms  
  359. *                                       ; are specified as undefined, but it 
  360. *                                       ; doesn't hurt to be safe.
  361. exitCustom          lda rtlAndDB+2
  362.                     pha
  363.                     lda rtlAndDB
  364.                     pha
  365.                     plb
  366.                     rtl
  367.  
  368.  
  369.  
  370. setCtlPort          ANOP                ; sets the current port to the control 
  371.                     pea 0               ; owning port specified in the control 
  372.                     pea 0               ; record
  373.                     _GetPort            ; save current port
  374.                     pla                 ; We do this because your control  
  375.                     sta lastPort        ; drawing procedure can get called 
  376.                     pla                 ; while the window your control is
  377.                     sta lastPort+2      ; in is not the front window.
  378.                     lda owningWindow+2
  379.                     pha
  380.                     lda owningWindow
  381.                     pha
  382.                     _SetPort
  383.                     rts
  384. restorePort         ANOP                ; reset the port to what it was on 
  385.                     lda lastPort+2      ; entry
  386.                     pha
  387.                     lda lastPort
  388.                     pha
  389.                     _SetPort
  390.                     rts
  391.  
  392.  
  393. drawRects           ANOP
  394. * draws the interior rectangles 
  395. * first we need the ctlValue for this one so we know
  396. * how to draw the rectangles
  397. * First, see if there is a custom color table
  398.                     lda boxColors       ; are boxColors non-zero?
  399.                     ora boxColors+2
  400.                     bne hasCustom
  401.                     brl nocustoms       ; they're zero, use defaults
  402. hasCustom  lda boxMoreFlags    ; read flags to see what kind of 
  403.                     and #$0C            ; reference this color table is
  404.                     beq dopointer
  405.                     cmp #$04
  406.                     beq dohandle
  407.                     pea 0               ; it's a resource.  Load and Go
  408.                     pea 0
  409.                     pea $800D           ; control color table resource type
  410.                     lda boxColors+2
  411.                     pha
  412.                     lda boxColors
  413.                     pha
  414.                     _LoadResource
  415. * if there was an error, go back to standards.  
  416. * You can also use _CMLoadResource here, since, as a ControlProc, 
  417. * you're considered part of the control manager.
  418. * But, if the load fails _CMLoadResource calls Sysdeath.I use _LoadResource
  419. * here because the color table is a non-critical part of my control and 
  420. * if it's missing I want to continue without death.
  421.  
  422.                     bcc keepitup
  423.                     stz boxColors       ; couldn't load the resource, 
  424.                     stz boxColors+2     ; change reference to zippo
  425.                     pla
  426.                     pla                 ; yank the bad handle
  427.                     bra drawRects       ; go back to the beginning
  428. dohandle            lda boxColors+2
  429.                     pha
  430.                     lda boxColors
  431.                     pha
  432.                     bra loadHand
  433. keepitup    lda #-1           ; flag that we loaded a resource
  434.                     sta loadedResource
  435. loadHand    pushlong #mycolorbuffer
  436.                     pea 0               ; Size, constant for this to avoid  
  437.                     pea 6               ; trouble if the resource or handle
  438.                     _HandToPtr    ; has been weirdly altered and not the right size anymore
  439.                     lda loadedResource
  440.                     beq dopats
  441.                     pea 3              ; purge level to set
  442.                     pea $800D      ; control table resource
  443.                     lda boxColors+2   ; id number
  444.                     pha
  445.                     lda boxColors
  446.                     pha
  447.                     _ReleaseResource   ; release it for now
  448.                     stz loadedResource  ; clear the flag 
  449.                     bra dopats         
  450. dopointer           anop
  451.                     pushlong #mycolorbuffer
  452.                     lda boxColors+2
  453.                     pha
  454.                     lda boxColors
  455.                     pha
  456.                     pea 0
  457.                     pea 6
  458.                     _BlockMove
  459.                     bra dopats
  460. nocustoms           anop
  461.                     ldx #4
  462. movedefs            lda defaultColors,x ; move the default colors over to the  
  463.                     sta mycolorbuffer,x ; pat area.  
  464.                     dex
  465.                     dex
  466.                     bpl movedefs
  467. dopats              anop
  468.                     ldx #30
  469. patfill             anop
  470.                     lda mycolorbuffer
  471.                     sta hiPat,x
  472.                     lda mycolorbuffer+2
  473.                     sta dimPat,x
  474.                     lda mycolorbuffer+4
  475.                     sta outlinePat,x
  476.                     dex
  477.                     dex
  478.                     bpl patfill
  479.  
  480.                     pushlong #patBuffer ; save the current GrafPort pen pat
  481.                     _GetPenPat
  482.                     lda ctlParamPassed
  483.                     beq drawAll         ; No parts to worry about -- draw the whole thing.
  484.  
  485.                     dea
  486.                     asl a
  487.                     tax                 ; Index for part code.
  488.  
  489.                     lda boxHilite       ; Check hiliting here.
  490.                     and #$FF
  491.                     beq drawAll         ; Put hiliting back to normal.
  492.  
  493.                     cmp #$FF            ; Is the control de-hilited?
  494.                     beq drawAll         ; Control is inactive.
  495.  
  496. hilitePart          lda #boxInnerRects|-16
  497.                     pha
  498.                     lda boxInnerRects,x
  499.                     pha
  500.  
  501.                     pushlong #outlinePat
  502.                     _SetPenPat
  503.                     pushlong #oldPen    ; save current pen size
  504.                     _GetPenSize
  505.                     pea 2
  506.                     pea 1
  507.                     _SetPenSize
  508.                     _FrameRect
  509.                     pushlong oldPen
  510.                     _SetPenSize
  511.                     pushlong #patBuffer ; restore the current GP pen pat
  512.                     _SetPenPat
  513.                     lda #0
  514.                     sta lastPartHit
  515.                     rts
  516.  
  517.  
  518. drawAll             pha                 ; Make work region.
  519.                     pha
  520.                     _NewRgn
  521.                     pla
  522.                     sta workRgn
  523.                     pla
  524.                     sta workRgn+2
  525.  
  526.                     pha                 ; Get clip region.
  527.                     pha
  528.                     _NewRgn
  529.                     lda 3,s
  530.                     pha
  531.                     lda 3,s
  532.                     pha
  533.                     _GetClip
  534.                     pla
  535.                     sta clipRgn
  536.                     pla
  537.                     sta clipRgn+2
  538.  
  539.                     pha
  540.                     pha
  541.                     _GetClipHandle
  542.                     pea masterRect|-16
  543.                     pea masterRect
  544.                     _RectRgn
  545.  
  546.                     lda #6              ; number of rects
  547. rectDrawing         pha
  548.                     asl a
  549.                     tax
  550.  
  551.                     lda workRgn+2
  552.                     pha
  553.                     lda workRgn
  554.                     pha
  555.  
  556.                     lda #boxInnerRects|-16
  557.                     ldy boxInnerRects,x
  558.                     pha
  559.                     phy
  560.                     pha
  561.                     phy
  562.  
  563.                     lda valueBits,x
  564.                     and boxValue        ; see if we're drawing this selected or 
  565.                     bne drawSet         ; unselected
  566.                     pushlong #dimPat
  567.                     bra setit
  568. drawSet             pushlong #hiPat
  569. setit               anop
  570.                     _SetPenPat
  571.                     _PaintRect
  572.                     _RectRgn
  573.  
  574.                     pha
  575.                     pha
  576.                     _GetClipHandle
  577.  
  578.                     lda workRgn+2
  579.                     pha
  580.                     lda workRgn
  581.                     pha
  582.  
  583.                     pha
  584.                     pha
  585.                     _GetClipHandle
  586.  
  587.                     _DiffRgn
  588.  
  589.                     pla
  590.                     dea
  591.                     bmi zzz
  592.                     brl rectDrawing
  593.  
  594. zzz                 ldx clipRgn+2
  595.                     ldy clipRgn
  596.                     phx
  597.                     phy
  598.                     phx
  599.                     phy
  600.                     _SetClip
  601.                     _DisposeRgn
  602.  
  603.                     lda workRgn+2
  604.                     pha
  605.                     lda workRgn
  606.                     pha
  607.                     _DisposeRgn
  608.  
  609.                     pushlong #patBuffer ; restore the current GP pen pat
  610.                     _SetPenPat
  611.                     rts
  612.  
  613. workRgn             dc i4'0'
  614. clipRgn             dc i4'0'
  615.  
  616. boxRoutines         dc i2'drawBox'
  617.                     dc i2'calcBox'
  618.                     dc i2'testBox'
  619.                     dc i2'initBox'
  620.                     dc i2'disposeBox'
  621.                     dc i2'positionBox'
  622.                     dc i2'thumbBox'
  623.                     dc i2'dragBox'
  624.                     dc i2'trackBox'
  625.                     dc i2'newboxValue'
  626.                     dc i2'newAdditionalParams'
  627.                     dc i2'moveBox'
  628.                     dc i2'sendRecSize'
  629.                     dc i2'boxHandleEvent'
  630.                     dc i2'boxStatusToggle'
  631.                     dc i2'boxRectChanged'
  632.                     dc i2'boxWindowChanged'
  633.                     dc i2'boxTabbedTo'
  634.                     dc i2'boxMultiPart'
  635.                     dc i2'boxWindStateChanged'
  636.  
  637.  
  638. rtlAndDB            ds 4
  639. ctlHandle           ds 4
  640. ctlParamPassed      ds 4
  641. lastPort            ds 4
  642.  
  643.  
  644. lastPartHit         dc i2'0'
  645.  
  646.  
  647. theControlRecord    ANOP                ; The first parameters ( up to boxVers ) 
  648. nextCtl             ds 4                ; are standard for an extended control
  649. owningWindow        ds 4                ;  record, and _must_ be present or
  650. masterRect          ds 8                ; the control manager cannot handle 
  651. boxFLags            ds 1                ; your custom control
  652. boxHilite           ds 1                ; correctly for many common actions.
  653. boxValue            ds 2
  654. boxstart            ds 4
  655. boxAction           dc i4'-1'           ; for a TrackRoutine, if we have one
  656. boxData             ds 4
  657. boxRefCon           ds 4
  658. boxColors           ds 4
  659.                     ds 16               ; reserved
  660. boxID               ds 4
  661. boxMoreFlags        ds 2
  662. boxVers             ds 2
  663. * Hit test and drawing rectangles
  664. * These will be passed into the control handle 
  665. * after creation of the control.
  666. * And passed back during action times
  667. iRect1              ds 8
  668. iRect2              ds 8
  669. iRect3              ds 8
  670. iRect4              ds 8
  671. iRect5              ds 8
  672. iRect6              ds 8
  673. iRect7              ds 8
  674. endControlRecord    ANOP
  675. recordLength        dc i2'endControlRecord-theControlRecord'
  676.  
  677. * and pointers to those rects....
  678. *                   Export boxInnerRects
  679. boxInnerRects       ANOP
  680.                     dc i2'iRect1'
  681.                     dc i2'iRect2'
  682.                     dc i2'iRect3'
  683.                     dc i2'iRect4'
  684.                     dc i2'iRect5'
  685.                     dc i2'iRect6'
  686.                     dc i2'iRect7'
  687.  
  688. * Here are the defaults for our control type, if the user 
  689. * doesn't select a color table or a bounding rect.
  690.  
  691. defaultRect         dc i2'30,100'
  692. mycolorbuffer       ds 6
  693. defaultColors       dc i2'0,$CCCC,$4444'                    ; black,grey,red
  694. * A small table of routine numbers that need the handle copied to this
  695. * proc area before taking action
  696. copiers             dc i2'0,2,3,9,11'
  697. * Pattern creation area
  698. hiPat               ds 32
  699. dimPat              ds 32
  700. outlinePat          ds 32
  701.  
  702. * The next two data stashes are for GrafPort variables in 
  703. * the port our control is currently in.
  704. * Be nice, save and restore anything you're changing in your ControlProc.  
  705. * If you change pen patterns, masks, sizes, or anything else be 
  706. * sure to reset them, or something else will get
  707. * drawn in funny ways.
  708. oldPen              ds 4                ; stash for old pen width
  709. patBuffer           ds 32               ; stash for current GrafPort pattern
  710.  
  711. * Masks for how to draw the different parts of the control
  712. valueBits           ANOP
  713.                     dc i2'%1'           ; top 
  714.                     dc i2'%10'          ; 2nd top 
  715.                     dc i2'%100'         ; inner bottom
  716.                     dc i2'%1000'        ; bottom bottom
  717.                     dc i2'%10000'       ; left side
  718.                     dc i2'%100000'      ; center
  719.                     dc i2'%1000000'     ; right
  720. loadedResource ds 2              ; flag for control color table load
  721.                     end
  722.                     end
  723.